<?php

class Pilotage_ModelmangementController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    	
    	$ajaxContext = $this->_helper->getHelper('AjaxContext');
        $ajaxContext->addActionContext('index', 'html')
                    ->addActionContext('add', array('html', 'json'))
                    ->initContext();
             
        if ($this->_request->isXmlHttpRequest())
        {
            $this->_helper->layout->disableLayout();
        }

    }

    public function indexAction()
    {
        // action body
        
    	$this->_helper->layout()->disableLayout();
    	//$this->_helper->layout()->setLayout("gestionlayout");
    	
		$form=new Application_Form_Affichmodele();
    	 
    	$dataprocess=new Application_Model_Mapper_PilotModelanalyse();
    	
    	//$listfilsprocess=$dataprocess->getDecissionpermise($this->_getParam('page'));
    	
    	//$this->view->Formulairetestindex=$listfilsprocess;
    	
    	$select=$dataprocess->fetchAllToArray();
    	// Create a Paginator for the blog posts query
    	$paginator = Zend_Paginator::factory($select);
    	
    	$paginator->setItemCountPerPage(10);
    	// set number of pages in page range
    	// Read the current page number from the request. Default to 1 if no explicit page number is provided.
    	$paginator->setCurrentPageNumber($this->_getParam('page'));
    	// Assign the Paginator object to the view
    	$this->view->paginator = $paginator;
    	$this->view->mappercours=$dataprocess;
    	// print_r($paginator);exit;
    	
    	// Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
    }

    public function assigneactivitemodelAction()
    {
        // action body
        
    	$this->_helper->layout()->disableLayout();
    	$this->_helper->layout()->setLayout("gestionlayout");
    	
    	$assignform = new Application_Form_Assigneaxeactivitemodel();
    	$this->view->form= $assignform;
    	
    	$assignform->setAction('assigneactivitemodel');
    	
    	$this->view->FormulaireAssignaxeactivite = $assignform;
    	
    	if (!empty($_POST)) {
    		$formData = $this->getRequest()->getPost();
    		if ($assignform->isValid($formData)) {
    			$checkb = $assignform->getValue('idPILOT_AXES');
    			$datas = new Application_Model_DbTable_PilotAxeactivite();
    			foreach ($checkb as $key){
    				
    				$data=array(
    						 
    						"idPILOT_AXEACTIVITE" =>  $formData["idPILOT_MODELACTIVITE"]."_".$key,
    						"idPILOT_MODELACTIVITE" => $formData["idPILOT_MODELACTIVITE"],
    						"idPILOT_AXES"=> $key,
    				);

    				$datas->insert($data);
    			}
    			$this->_helper->redirector('gestionassignemodelctivite');
    		} else {
    			$assignform->populate($formData);
    		}
    	}
    }

    public function assignemacitiveanalyseAction()
    {
        // action body
    	
    	$this->_helper->layout()->disableLayout();
    	$this->_helper->layout()->setLayout("gestionlayout");
    	 
    	$assignform = new Application_Form_Assigneanalyseactivite();
    	$this->view->form= $assignform;
    	 
    	$assignform->setAction('assignemacitiveanalyse');
    	 
    	$this->view->FormulaireAssignanalyseactivite = $assignform;
    	 
    	if (!empty($_POST)) {
    		$formData = $this->getRequest()->getPost();
    		
    		
    		if ($assignform->isValid($formData)) {
    			$checkb = $formData['ACTIVITE'];
				
    			$datas = new Application_Model_DbTable_PilotModelactiviteanalyse();
    			foreach ($checkb as $value)
    			{
    					
    				$data=array(
    							
    						"idPILOT_MODELACTIVITEANALYSE" =>  $formData["idPILOT_MODELANALYSE"]."_".$value,
    						"idPILOT_MODELANALYSE" => $formData["idPILOT_MODELANALYSE"],
    						"idPILOT_MODELACTIVITE"=> $value,
    				);
    				
    				$datas->insert($data);
    			}
    			$this->_helper->redirector('gestionassigneaxeactivite');
    		} else {
    			$assignform->populate($formData);
    		}
    	}
    }

    public function addaxesAction()
    {
        // action body
   
    	$this->_helper->layout()->disableLayout();
    	$this->_helper->layout()->setLayout("gestionlayout");
    	 
    	$assignform = new Application_Form_Addaxes();
    	 
    	$this->view->form = $assignform;
    	
    	$AFA = new Application_Form_Addaxes();
    	
    	$AFA->setAction('addaxes');
    	
    	$this->view->FormulaireAjoutaxe = $AFA;
    	
    	if ($this->_request->isPost ())
    	{
    		$formData = $this->_request->getPost ();
    		 
    		if ($AFA->isValid ( $formData ))
    		{
    			$datas = $formData;
    			 
    			 
    			$listmodele= new Application_Model_DbTable_PilotAxes();
    	
    	
    			$data=array(
    						
    					"idPILOT_AXES" => $datas['idPILOT_AXES']
    	
    			);
    	
    			$listmodele->insert($data);
    			$this->_helper->redirector("affichaxe");
    		}
    		 
    	}
    }

    
  	public function affichaxeAction()
    {
    
    
    	$this->_helper->layout()->disableLayout();
    	$this->_helper->layout()->setLayout("gestionlayout");
    
    
    	$header=array(
    			"idPILOT_AXES"=>"Nom de l'axe",
    
    
    
    	);
    	$usermapper= new Application_Model_Mapper_PilotAxes();
    	$select=$usermapper->fetchAllToArray();
    	$page=$this->_getParam('page',1);
    	$paginator = Zend_Paginator::factory($select);
    	$paginator->setItemCountPerPage(3);
    	$paginator->setCurrentPageNumber($page);
    
    	$this->view->header=$header;
    
    	$this->view->keyOfData="idPILOT_AXES";
    
    	Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
    	$this->view->paginator=$paginator;
    
    
    
    }
    
    public function addactiviteAction()
    {
        // action body
	    $this->_helper->layout()->disableLayout();
	    $this->_helper->layout()->setLayout("gestionlayout");
	    	
	 	$assignform = new Application_Form_Addmodelactivite();
    	 
    	$this->view->form = $assignform;
    	
    	$AFA = new Application_Form_Addmodelactivite();
    	
    	$AFA->setAction('addactivite');
    	
    	$this->view->FormulaireAjoutactivite = $AFA;
    	
    	 
    	
    	if ($this->_request->isPost ())
    	{
    		$formData = $this->_request->getPost ();
    		 
    		if ($AFA->isValid ( $formData ))
    		{
    			$datas = $formData;
    			 
    			 
    			$listmodele= new Application_Model_DbTable_PilotModelactivite();
    	
    	
    			$data=array(
    						
    					"idPILOT_MODELACTIVITE" => $datas['idPILOT_MODELACTIVITE'],
    					"DESCRIPTION" => $datas['DESCRIPTION'],
    					);
    	
    			$listmodele->insert($data);
    			$this->_helper->redirector("affichactivite");
    		}
    		 
    	}
    	 
    }

    
	public function affichactiviteAction()
    {
    
    	$this->_helper->layout()->disableLayout();
    	$this->_helper->layout()->setLayout("gestionlayout");
    	//$this->_helper->layout()->setLayout("template1");
    
    
    	$header=array(
    			"idPILOT_MODELACTIVITE"=>"Activite",
    			"DESCRIPTION"=>"Description",
    
    
    	);
    	$usermapper= new Application_Model_Mapper_PilotModelactivite();
    	$select=$usermapper->fetchAllToArray();
    	$page=$this->_getParam('page',1);
    	$paginator = Zend_Paginator::factory($select);
    	$paginator->setItemCountPerPage(3);
    	$paginator->setCurrentPageNumber($page);
    
    	$this->view->header=$header;
    
    	$this->view->keyOfData="idPILOT_MODELACTIVITE";
    
    	Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
    	$this->view->paginator=$paginator;
    
    }
    
    public function addmodeleAction()
    {
        // action body
        
    	$this->_helper->layout()->disableLayout();
    	$this->_helper->layout()->setLayout("gestionlayout");
    	
    	$assignform = new Application_Form_Ajoutmodele();
    	
    	$this->view->form = $assignform;
    	 
    	$AFA = new Application_Form_Ajoutmodele();
    	 
    	$AFA->setAction('addmodele');
    	 
    	$this->view->FormulaireAjoutmodele = $AFA;
    	 
    	
    	 
    	if ($this->_request->isPost ())
    	{
    		$formData = $this->_request->getPost ();
    		 
    		if ($AFA->isValid ( $formData ))
    		{
    			$datas = $formData;
    	
    	
    			$listmodele= new Application_Model_DbTable_PilotModelanalyse();
    			 
    			 
    			$data=array(
    					"PILOT_PLATEFORME_idPILOT_PLATEFORME"=>$datas['PILOT_PLATEFORME_idPILOT_PLATEFORME'],
    					"idPILOT_MODELANALYSE" => $datas['idPILOT_MODELANALYSE'],
    					"NOMMODEL" => $datas['NOMMODEL'],
    					"XMTTEXT" => $datas['XMTTEXT'],
    					
    						
    			);
    			 
    			$listmodele->insert($data);
    			$this->_helper->redirector("affichmodele");
    		}
    		 
    	}
    	
    	
    	
    }

    public function affichmodeleAction()
    {
        // action body
        
    	//$this->_helper->layout()->disableLayout();
    	/*$this->_helper->layout()->setLayout("gestionlayout");
    	
    	$AFAffich = new  Application_Form_Affichmodele();
    	$AFAffich->setAction('affichmodele');
    	$this->view->Formulaireaffichermodele = $AFAffich;
    	$usermapper= new Application_Model_Mapper_PilotModelanalyse();
    	$this->view->Formulaireaffichermodele = $usermapper->fetchAllToArray($usermapper);*/
    	
    	
    	$this->_helper->layout()->disableLayout();
    	$this->_helper->layout()->setLayout("gestionlayout");
    	 
    	
    	$header=array(
    			"PILOT_PLATEFORME_idPILOT_PLATEFORME"=>"Plateforme",
    			"idPILOT_MODELANALYSE"=>"Identificateur",
    			"NOMMODEL"=>"Nom de model",
    			"XMTTEXT"=>"Description"
    	);
    	$usermapper= new Application_Model_Mapper_PilotModelanalyse();
    	$select=$usermapper->fetchAllToArray();
    	$page=$this->_getParam('page',1);
    	$paginator = Zend_Paginator::factory($select);
    	$paginator->setItemCountPerPage(3);
    	$paginator->setCurrentPageNumber($page);
    	
    	$this->view->header=$header;
    	
    	$this->view->keyOfData="idPILOT_MODELANALYSE";
    	
    	Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
    	$this->view->paginator=$paginator;
    	
    	
  	
    }


    public function deletemodeleAction()
    {
 	
    	// action body
        
    $this->_helper->layout()->disableLayout();
   // $this->_helper->layout()->setLayout("gestionlayout");
    	
    	$this->view->id = $this->_getParam('id');
    	$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
    	
    	if ($this->_request->isPost())
    	{
    		$formData = $this->_request->getPost ();
    	
    		 print_r($formData);
    		if ($formData['operation']=="oui")
    		{
    			 
    			$modele = new Application_Model_PilotModelanalyse();
    			
    			$projectmodel= new Application_Model_DbTable_PilotModelanalyse();
    			
    			$projectmodel->delete(array(" idPILOT_MODELANALYSE = ? " => $this->_getParam('id')));
    			
    			$this->_helper->redirector('gestionmodele','Modelmangement');
    		}
    		
    		else
    		{
    		
    			$this->_helper->redirector("gestionmodele");
    			
    		}
    	}
    }

    public function gestionmodeleAction()
    {
        // action body
    	$this->_helper->layout()->disableLayout();
        $this->_helper->layout()->setLayout("gestionlayout");
     
     $header=array(
       "PILOT_PLATEFORME_idPILOT_PLATEFORME"=>"Plateforme",
        "idPILOT_MODELANALYSE"=>"Identificateur Modele",
        "NOMMODEL"=>"Nom de model",
        "XMTTEXT"=>"Description"
       );
     
     $usermapper= new Application_Model_Mapper_PilotModelanalyse();
     $select=$usermapper->fetchAllToArray();
     $page=$this->_getParam('page',1);
     $paginator = Zend_Paginator::factory($select);
     $paginator->setItemCountPerPage(3);
     $paginator->setCurrentPageNumber($page);
      
     $this->view->header=$header;
     
     $this->view->keyOfData="idPILOT_MODELANALYSE";
     
     Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
     $this->view->paginator=$paginator;
    }

    public function actdeletmodelAction()
    {
        // action body
    }

    public function updatemodeleAction()
    {
        // action body
    $this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
		 
		$AFAffich = new  Application_Form_Modifiermodele();
		$AFAffich->setAction('updatemodele');
		$this->view->Formulairemodofiermodele = $AFAffich;
		 
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
			if ($AFAffich->isValid($formData)) {
				
				$requet = new Application_Model_DbTable_PilotModelanalyse();
				 
				print_r($requet);
				$requet->update(array(
						//"idPILOT_PROJECT" =>$AFAffich->getValue('idPILOT_PROJECT'),
						"XMTTEXT"=>$AFAffich->getValue('XMTTEXT'),
						"PILOT_PLATEFORME_idPILOT_PLATEFORME"=>$AFAffich->getValue('PILOT_PLATEFORME_idPILOT_PLATEFORME'),
						"NOMMODEL"=>$AFAffich->getValue('NOMMODEL')),
						"idPILOT_MODELANALYSE = '".$AFAffich->getValue('idPILOT_MODELANALYSE')."'");
				
				$this->_helper->redirector("gestionmodele");
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$modele = new Application_Model_DbTable_PilotModelanalyse();
				$data=$modele->fetchRow(" idPILOT_MODELANALYSE = '".$id."'")->toArray();
				 
				$AFAffich->populate($data);
			}
			 
		}
	
    }
    public function axeactiviteAction()
    {
        // action body
        
}

public function definirlistcolonAction()
{
	// action body
	
	//$this->_helper->layout()->disableLayout();
	$this->_helper->layout()->setLayout("gestionlayout");
	 
	$AFAffich = new  Application_Form_Definirlistecolones();
	$AFAffich->setAction('definirlistcolon');
	$this->view->Formulairedeflistecolones = $AFAffich;
	
	if ($this->_request->isPost ())
	{
		$formData = $this->_request->getPost ();
		 
		if ($AFAffich->isValid ( $formData ))
		{
			$datas = $formData;
			 
			$listmodele= new Application_Model_DbTable_PilotListcolumn();
	
			$data=array(
						
					"idPILOT_LISTCOLUMN" => $datas['idPILOT_LISTCOLUMN'],
					"LABELCOLUMN" => $datas['LABELCOLUMN'],
					"DESCRIPTION" => $datas['DESCRIPTION'],
					"TABELCOLUM" => $datas['TABLE'],
					"COLUMNNAME" => $datas['COLON'],
					"OPERATIONSQL" => $datas['OPERATION'],
					"PILOT_PLATEFORME_idPILOT_PLATEFORME" => $datas['idPILOT_PLATEFORME'],
			);
	
			$listmodele->insert($data);
			$this->_helper->redirector("consulterlistecolonnes");
		}
	}
}
public function managerequestAction()
	{
		// action body

		$AFAffich = new  Application_Form_Managerequest();
		$AFAffich->setAction('managerequest');
		$this->view->Formulairemanagerequest = $AFAffich;
		
		//$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
		
		$req= $this->getRequest();
		$id =$req->getParam('idPILOT_REQUEST');
		
		$header=array(
				"idPILOT_REQUEST"=>"ID",
				"REQUESTTEXT"=>"Requete",
				//"idPILOT_MODELANALYSE"=>"Nom du Modele",
				//"LABELRequest"=>"Contrainte",
				"NOMMODEL"=>"Model",
				"XMTTEXT"=>"Description",
				"PILOT_PLATEFORME_idPILOT_PLATEFORME"=>"Plateform",
				"idPILOT_REQUESTCOMP"=>"ID contrainte",
				"AXENOM"=>"Axe",
				"PILOT_AXES_idPILOT_AXES"=>"ID axe",
				);
		
		$usermapper= new Application_Model_Mapper_PilotRequest();
		$select=$usermapper->gestRequet_list($id);
		//var_dump($select);
		$page=$this->_getParam('page',1);
		$paginator = Zend_Paginator::factory($select);
		$paginator->setItemCountPerPage(3);
		$paginator->setCurrentPageNumber($page);
		
		$this->view->header=$header;
		
		$this->view->keyOfData="idPILOT_REQUESTCOMP";
		
		$this->view->keyOfData2="idPILOT_MODELANALYSE";
		
		$this->view->keyOfData3="idPILOT_DEFCOLUMN";
		
		$this->view->keyOfData4="idPILOT_REQUEST";
		
		
		Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
		$this->view->paginator=$paginator;
}

public function constraintAction()
{
	// action body

	$this->_helper->layout()->disableLayout();
	$this->_helper->layout()->setLayout("gestionlayout");
	 
	$assignform = new Application_Form_Contrainte();

	$this->view->form = $assignform;
	 
	$AFA = new Application_Form_Contrainte();
	 
	$AFA->setAction('constraint');
	 
	$this->view->Formulairecontraint = $AFA;
	 

	 
	if ($this->_request->isPost ())
	{
		$formData = $this->_request->getPost ();
		 
		if ($AFA->isValid ( $formData ))
		{
			$datas = $formData;


			$listmodele= new Application_Model_DbTable_PilotRequestcomp();
			 
			 
			$data=array(
					"idPILOT_REQUESTCOMP" => $datas['idPILOT_REQUESTCOMP'],
					"WHEREZONE" => $datas['WHEREZONE'],
					"FROMZONE" => $datas['FROMZONE'],
					"SELECTZONE" => $datas['SELECTZONE'],
					"GROUPBYZONE" => $datas['GROUPBYZONE'],
					"JOINTUREZONE" => $datas['JOINTUREZONE'],
					"HAVAINGZONE" => $datas['HAVAINGZONE'],
					"ORDERBYZONE" => $datas['ORDERBYZONE'],
					"PILOT_REQUEST_idPILOT_REQUEST" => $datas['REQUESTTEXT'],
			);
			 
			 
			$listmodele->insert($data);
			$this->_helper->redirector("consulterconstraint");
		}
		 
	}

}

public function deleteconstrainteAction()
{

	// action body

	$this->_helper->layout()->disableLayout();
	// $this->_helper->layout()->setLayout("gestionlayout");
	 
	$this->view->id = $this->_getParam('id');
	$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
	 
	if ($this->_request->isPost())
	{
		$formData = $this->_request->getPost ();
		 
		print_r($formData);
		if ($formData['operation']=="oui")
		{

			$modele = new Application_Model_PilotRequestcomp();
			 
			$projectmodel= new Application_Model_DbTable_PilotRequestcomp();
			 
			$projectmodel->delete(array(" idPILOT_REQUESTCOMP = ? " => $this->_getParam('id')));
			 
			$this->_helper->redirector('consulterconstraint','Modelmangement');
		}

		else
		{

			$this->_helper->redirector("consulterconstraint");
			 
		}
	}
}

public function defrequeteAction()
{
	// action body

	$this->_helper->layout()->disableLayout();
	$this->_helper->layout()->setLayout("gestionlayout");
	 
	$assignform = new Application_Form_Defrequete();

	$this->view->form = $assignform;
	 
	$AFA = new Application_Form_Defrequete();
	 
	$AFA->setAction('defrequete');
	 
	$this->view->FormulaireDefrequete = $AFA;
	 
	if ($this->_request->isPost ())
	{
		$formData = $this->_request->getPost ();
		 
		if ($AFA->isValid ( $formData ))
		{
			$datas = $formData;
			$listmodele= new Application_Model_DbTable_PilotRequest();
			 
			$data=array(

					"idPILOT_REQUEST" => $datas['idPILOT_REQUEST'],
					"REQUESTTEXT" => $datas['REQUESTTEXT'],
					"idPILOT_MODELANALYSE" => $datas['idPILOT_MODELANALYSE'],
					"LABELRequest" => $datas['LABELRequest'],
					"servicedemande" => $datas['servicedemande'],
					"WITHCHART" => $datas['WITHCHART'],
			);
			 
			$listmodele->insert($data);
			$this->_helper->redirector("managerequest");
		}
		 
	}
}

public function modifiermodelgestionrequestAction()

{
	$this->_helper->layout()->disableLayout();
	$this->_helper->layout()->setLayout("gestionlayout");
		
	$AFAffich = new  Application_Form_Modifiermodele();
	$AFAffich->setAction('modifiermodelgestionrequest');
	$this->view->Formulairemodofiermodele = $AFAffich;
		
	if ($this->getRequest()->isPost()) {
		$formData = $this->getRequest()->getPost();
		if ($AFAffich->isValid($formData)) {
	
			$requet = new Application_Model_DbTable_PilotModelanalyse();
				
			print_r($requet);
			$requet->update(array(
					//"idPILOT_PROJECT" =>$AFAffich->getValue('idPILOT_PROJECT'),
					"XMTTEXT"=>$AFAffich->getValue('XMTTEXT'),
					"PILOT_PLATEFORME_idPILOT_PLATEFORME"=>$AFAffich->getValue('PILOT_PLATEFORME_idPILOT_PLATEFORME'),
					"NOMMODEL"=>$AFAffich->getValue('NOMMODEL')),
					"idPILOT_MODELANALYSE = '".$AFAffich->getValue('idPILOT_MODELANALYSE')."'");
	
			$this->_helper->redirector("managerequest");
		} else {
			$AFAffich->populate($formData);
		}
	} else {
		$id = $this->_getParam('id');
		if (!empty($id)) {
			$modele = new Application_Model_DbTable_PilotModelanalyse();
			$data=$modele->fetchRow(" idPILOT_MODELANALYSE = '".$id."'")->toArray();
				
			$AFAffich->populate($data);
		}
	
	}
	
}

public function modifiercontraintesgestionrequestAction()

{
	$this->_helper->layout()->disableLayout();
	$this->_helper->layout()->setLayout("gestionlayout");
	 
	$AFAffich = new  Application_Form_modifcontraint();
	$AFAffich->setAction('modifiercontraint');
	$this->view->Formulairemodifiercontraint = $AFAffich;
	 
	if ($this->getRequest()->isPost()) {
		$formData = $this->getRequest()->getPost();
		if ($AFAffich->isValid($formData)) {
			$id = $AFAffich->getValue('idPILOT_REQUESTCOMP');
			$req = $AFAffich->getValue('REQUESTTEXT');
			$wher = $AFAffich->getValue('WHEREZONE');
			$from = $AFAffich->getValue('FROMZONE');
			$select = $AFAffich->getValue('SELECTZONE');
			$group = $AFAffich->getValue('GROUPBYZONE');
			$having = $AFAffich->getValue('HAVAINGZONE');
			$join = $AFAffich->getValue('JOINTUREZONE');
			$order = $AFAffich->getValue('ORDERBYZONE');
			 
			$albums = new Application_Model_DbTable_PilotRequestcomp();
			 
			$albums->update(array(
					"PILOT_REQUEST_idPILOT_REQUEST"=>$AFAffich->getValue('PILOT_REQUEST_idPILOT_REQUEST'),
					"WHEREZONE" =>$AFAffich->getValue('WHEREZONE'),
					"FROMZONE"=>$AFAffich->getValue('FROMZONE'),
					"SELECTZONE"=>$AFAffich->getValue('SELECTZONE'),
					"GROUPBYZONE"=>$AFAffich->getValue('GROUPBYZONE'),
					"HAVAINGZONE"=>$AFAffich->getValue('HAVAINGZONE'),
					"JOINTUREZONE"=>$AFAffich->getValue('JOINTUREZONE'),
					"ORDERBYZONE"=>$AFAffich->getValue('ORDERBYZONE')
			),"idPILOT_REQUESTCOMP = '".$AFAffich->getValue('idPILOT_REQUESTCOMP')."'");
			 
			// print_r($albums);
			// die();
			$this->_helper->redirector("managerequest");
		} else {
			$AFAffich->populate($formData);
		}
	} else {
		$id = $this->_getParam('id');
		if (!empty($id)) {
			$modele = new Application_Model_DbTable_PilotRequestcomp();
			 
			// print_r($modele);
			//die();
			 
			 
			 
			$data=$modele->fetchRow("idPILOT_REQUESTCOMP = '".$id."'")->toArray();
			 
	
			 
			 
			$AFAffich->populate($data);
		}
		 
	}	
}

public function modifierrequetAction()

	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
		 
		$AFAffich = new  Application_Form_modifrequete();
		$AFAffich->setAction('modifierreque');
		$this->view->FormulaireModifrequete = $AFAffich;
		 
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
			if ($AFAffich->isValid($formData)) {
				$id = $AFAffich->getValue('idPILOT_REQUEST');
				$label = $AFAffich->getValue('LABELRequest');
				$model = $AFAffich->getValue('idPILOT_MODELANALYSE');
				$text = $AFAffich->getValue('REQUESTTEXT');
				$requet = new Application_Model_DbTable_PilotRequest();
				 
				
				$requet->update(
						array(
							//"idPILOT_PROJECT" =>$AFAffich->getValue('idPILOT_PROJECT'),
							"idPILOT_MODELANALYSE"=>$AFAffich->getValue('idPILOT_MODELANALYSE'),
							"servicedemande" => $AFAffich->getValue('servicedemande'),
							"REQUESTTEXT"=>$AFAffich->getValue('REQUESTTEXT'),
							"LABELRequest"=>$AFAffich->getValue('LABELRequest'),
							"WITHCHART" => $AFAffich->getValue('WITHCHART')
						),
						"idPILOT_REQUEST = '".$AFAffich->getValue('idPILOT_REQUEST')."'"
						);
				
				$this->_helper->redirector("managerequest");
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$modele = new Application_Model_DbTable_PilotRequest();
				$data=$modele->fetchRow(" idPILOT_REQUEST = '".$id."'")->toArray();
				 
				$AFAffich->populate($data);
			}
			 
		}
	
	}

	public function ajoutdefcolonneAction()
	{
		//$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
		
		$AFAffich = new  Application_Form_ajoutdefcolonne();
		$AFAffich->setAction('ajoutdefcolonne');
		$this->view->FormulaireAjoutdefcolonee = $AFAffich;
		
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
				
			if ($AFAffich->isValid ( $formData ))
			{
				$datas = $formData;
		
				$listmodele= new Application_Model_DbTable_PilotDefcolumn();
		
				$data=array(
						"ISCHART" => $datas['ISCHART'],
						"idPILOT_LISTCOLUMN" => $datas['idPILOT_LISTCOLUMN'],
						"PILOT_REQUEST_idPILOT_REQUEST" => $datas['PILOT_REQUEST_idPILOT_REQUEST'],
						"ISCHART" => $datas['ISCHART'],
						"CHART_AXE" => $datas['CHART_AXE'],
						"AXENOM" => $datas['AXENOM'],
						"PILOT_AXES_idPILOT_AXES" => $datas['PILOT_AXES_idPILOT_AXES'],
				);
		
				$listmodele->insert($data);
				$this->_helper->redirector("gestiondefinitiondescolonnes");
			}
		}	
	}
	public function modifierdefcolonneAction()
	
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
			
		$AFAffich = new  Application_Form_modifierdefcolonne();
		$AFAffich->setAction('modifierdefcolonne');
		$this->view->Formulairemodifierdefcolonee = $AFAffich;
			
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
			if ($AFAffich->isValid($formData)) {
			
				$albums = new Application_Model_DbTable_PilotDefcolumn();

				$albums->update(array(
						"CHART_AXE"=>$AFAffich->getValue('CHART_AXE'),
						"ISCHART"=>$AFAffich->getValue('ISCHART'),
						"AXENOM"=>$AFAffich->getValue('AXENOM'),
						"idPILOT_LISTCOLUMN" => $AFAffich->getValue('idPILOT_LISTCOLUMN'),
						"PILOT_REQUEST_idPILOT_REQUEST"=> $AFAffich->getValue('PILOT_REQUEST_idPILOT_REQUEST'),
						"PILOT_AXES_idPILOT_AXES" => $AFAffich->getValue('PILOT_AXES_idPILOT_AXES')),
						"idPILOT_DEFCOLUMN = '".$AFAffich->getValue('idPILOT_DEFCOLUMN')."'");
						
				$this->_helper->redirector("gestiondefinitiondescolonnes");
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$reqcomp = new Application_Model_DbTable_PilotDefcolumn();
				$data=$reqcomp->fetchRow("idPILOT_DEFCOLUMN = '".$id."'")->toArray();
					
				$AFAffich->populate($data);
			}
		}
	}
	
	public function ajouternamecolonneAction()
	
	{
		//$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
		
		$AFAffich = new  Application_Form_ajouternamecolum();
		$AFAffich->setAction('ajouternamecolonne');
		$this->view->FormulaireAjoutnamecolonne = $AFAffich;
		
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
		
			if ($AFAffich->isValid ( $formData ))
			{
				$datas = $formData;
		
				$listmodele= new Application_Model_DbTable_PilotNamecolumn();
		
				$data=array(
						"LABELLANGUE" => $datas['LABELLANGUE'],
						"idPILOT_LISTCOLUMN" => $datas['idPILOT_LISTCOLUMN'],
						"idLANGUE" => $datas['idLANGUE'],
				);
		
				$listmodele->insert($data);
				$this->_helper->redirector("gestionnamecolonnes");
			}
		}
	}
	
	public function modifiernamecolonneAction()
	
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
			
		$AFAffich = new  Application_Form_modifiernamecolonne();
		$AFAffich->setAction('modifiernamecolonne');
		$this->view->Formulairemodifiernamecolonne = $AFAffich;
			
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
			if ($AFAffich->isValid($formData)) {
				/*$id = $AFAffich->getValue('idPILOT_NAMECOLUMN');
				$label = $AFAffich->getValue('LABELLANGUE');
				$idlistclient = $AFAffich->getValue('idPILOT_LISTCOLUMN');
				$langue = $AFAffich->getValue('idLANGUE');*/
				
				$albums = new Application_Model_DbTable_PilotNamecolumn();
				/*
				echo($AFAffich->getValue('LABELLANGUE'));
				exit;*/
				//echo $AFAffich->getValue('idPILOT_NAMECOLUMN');exit;
				$albums->update(array(
						
						"LABELLANGUE"=>$AFAffich->getValue('LABELLANGUE'),
						
						"idPILOT_LISTCOLUMN"=>$AFAffich->getValue('idPILOT_LISTCOLUMN'),
						"idLANGUE"=>$AFAffich->getValue('idLANGUE')),
						"idPILOT_NAMECOLUMN = '".$AFAffich->getValue('idPILOT_NAMECOLUMN')."'");
					
				$this->_helper->redirector("gestionnamecolonnes");
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$modele = new Application_Model_DbTable_PilotNamecolumn();
				$data=$modele->fetchRow("idPILOT_NAMECOLUMN = '".$id."'")->toArray();
					
				$AFAffich->populate($data);
			}
		}
	}
			
		public function gestiondefinitiondescolonnesAction()
		{
			
			$AFAffich = new  Application_Form_gestiondefinitiondescolonnes();
			$AFAffich->setAction('gestiondefinitiondescolonnes');
			$this->view->Formulairegestiondefinitiondescolonnes = $AFAffich;
			
			//$this->_helper->layout()->disableLayout();
			$this->_helper->layout()->setLayout("gestionlayout");
			
			$req= $this->getRequest();
			$id =$req->getParam('idPILOT_DEFCOLUMN');
			
			
			
			$header=array(
					"idPILOT_DEFCOLUMN"=>"ID",
					"idPILOT_LISTCOLUMN"=>"idPILOT_LISTCOLUMN",
					"PILOT_REQUEST_idPILOT_REQUEST"=>"PILOT_REQUEST_idPILOT_REQUEST",
					"CHART_AXE"=>"CHART_AXE",
					"idPILOT_REQUEST"=>"idPILOT_REQUEST",
					"ISCHART"=>"ISCHART",
					"REQUESTTEXT"=>"REQUESTTEXT",
					"idPILOT_MODELANALYSE"=>"idPILOT_MODELANALYSE",
					"LABELRequest"=>"LABELRequest",
					"AXENOM"=>"AXENOM",
					"PILOT_AXES_idPILOT_AXES"=>"ID PILOT_AXES_idPILOT_AXES",
					
			);
		
			$usermapper= new Application_Model_Mapper_PilotDefcolumn();
			$select=$usermapper->getdefcolumn($id);
			//print_r($select);
			//exit;
				
			$page=$this->_getParam('page',1);
			$paginator = Zend_Paginator::factory($select);
			$paginator->setItemCountPerPage(3);
			$paginator->setCurrentPageNumber($page);
			 
			$this->view->header=$header;
		
			$this->view->keyOfData="idPILOT_DEFCOLUMN";
		
			Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
			$this->view->paginator=$paginator;
		}
		
		public function gestionnamecolonnesAction()
		{
			// action body
			$this->_helper->layout()->disableLayout();
			$this->_helper->layout()->setLayout("gestionlayout");
		
		
			$header=array(
					"idPILOT_NAMECOLUMN"=>"Definition colonne",
					"LABELLANGUE"=>"Label",
					"idPILOT_LISTCOLUMN"=>"Colonne",
					"idLANGUE"=>"Langue",
			);
		
			$usermapper= new Application_Model_Mapper_PilotNamecolumn();
			$select=$usermapper->fetchAllToArray();
			$page=$this->_getParam('page',1);
			$paginator = Zend_Paginator::factory($select);
			$paginator->setItemCountPerPage(3);
			$paginator->setCurrentPageNumber($page);
		
			$this->view->header=$header;
		
			$this->view->keyOfData="idPILOT_NAMECOLUMN";
		
			Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
			$this->view->paginator=$paginator;
		}
	
		
	public function modifiercontraintAction()
		{
		 $this->_helper->layout()->disableLayout();
    	 $this->_helper->layout()->setLayout("gestionlayout");
     
	     $AFAffich = new  Application_Form_modifcontraint();
	     $AFAffich->setAction('modifiercontraint');
	     $this->view->Formulairemodifiercontraint = $AFAffich;
     
		     if ($this->getRequest()->isPost()) {
		      $formData = $this->getRequest()->getPost();
		      if ($AFAffich->isValid($formData)) {
		       $id = $AFAffich->getValue('idPILOT_REQUESTCOMP');
		       $req = $AFAffich->getValue('REQUESTTEXT');
		       $wher = $AFAffich->getValue('WHEREZONE');
		       $from = $AFAffich->getValue('FROMZONE');
		       $select = $AFAffich->getValue('SELECTZONE');
		       $group = $AFAffich->getValue('GROUPBYZONE');
		       $having = $AFAffich->getValue('HAVAINGZONE');
		       $join = $AFAffich->getValue('JOINTUREZONE');
		       $order = $AFAffich->getValue('ORDERBYZONE');
		       
		       $albums = new Application_Model_DbTable_PilotRequestcomp();
		       
		       $albums->update(array(
		        "PILOT_REQUEST_idPILOT_REQUEST"=>$AFAffich->getValue('PILOT_REQUEST_idPILOT_REQUEST'),
		        "WHEREZONE" =>$AFAffich->getValue('WHEREZONE'),
		        "FROMZONE"=>$AFAffich->getValue('FROMZONE'),
		       	"SELECTZONE"=>$AFAffich->getValue('SELECTZONE'),
		       	"GROUPBYZONE"=>$AFAffich->getValue('GROUPBYZONE'),
		       	"HAVAINGZONE"=>$AFAffich->getValue('HAVAINGZONE'),
		       	"JOINTUREZONE"=>$AFAffich->getValue('JOINTUREZONE'),
		       	"ORDERBYZONE"=>$AFAffich->getValue('ORDERBYZONE')
		         ),"idPILOT_REQUESTCOMP = '".$AFAffich->getValue('idPILOT_REQUESTCOMP')."'");
		       
		       // print_r($albums);
		      // die();
		       $this->_helper->redirector("consulterconstraint");
		      } else {
		       $AFAffich->populate($formData);
		      }
		     } else {
		      $id = $this->_getParam('id');
		      if (!empty($id)) {
		       $modele = new Application_Model_DbTable_PilotRequestcomp();
		       
		      // print_r($modele);
		      //die();
		       
		       $data=$modele->fetchRow("idPILOT_REQUESTCOMP = '".$id."'")->toArray();
		       
		       $AFAffich->populate($data);
		      }
		     
		   }
	}
	
	public function menugestplateformeAction()
	{
		$this->_helper->layout()->disableLayout();
		//$this->_helper->layout()->setLayout("gestionlayout");
		
		$AFA = new Application_Form_menugestiondesplateformes();
		 
		$AFA->setAction('menugestplateforme');
		 
		$this->view->Formulairemenugestplateformes = $AFA;
	}
	
	public function menugestcolonnesAction()
	{
		$this->_helper->layout()->disableLayout();
		//$this->_helper->layout()->setLayout("gestionlayout");
		
		$AFA = new Application_Form_menugestcolonnes();
			
		$AFA->setAction('menugestcolonnes');
			
		$this->view->Formulairemenugestcolonnes = $AFA;
	}
	
	public function menugestrequetteAction()
	{
		$this->_helper->layout()->disableLayout();
		//$this->_helper->layout()->setLayout("gestionlayout");
	
		$AFA = new Application_Form_menugestrequette();
			
		$AFA->setAction('menugestrequette');
			
		$this->view->Formulairemenugestrequette = $AFA;
	}
	
	public function consulterconstraintAction()
	{
		// action body
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
		
		$header=array(
				"idPILOT_REQUESTCOMP" =>"ID",
					"WHEREZONE" => "Contrainte",
					"FROMZONE" => "Table",
					"SELECTZONE" => "Champs",
					"GROUPBYZONE" => "Regrouper",
					"JOINTUREZONE" => "Jointure",
					"HAVAINGZONE" => "Having",
					"ORDERBYZONE" => "OrderBy",
					"PILOT_REQUEST_idPILOT_REQUEST" => "ID Requete"
		);
		
		$usermapper= new Application_Model_Mapper_PilotRequestcomp();
		$select=$usermapper->fetchAllToArray();
		$page=$this->_getParam('page',1);
		$paginator = Zend_Paginator::factory($select);
		$paginator->setItemCountPerPage(3);
		$paginator->setCurrentPageNumber($page);
		
		$this->view->header=$header;
		
		$this->view->keyOfData="idPILOT_REQUESTCOMP";
		
		Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
		$this->view->paginator=$paginator;
	}
	
	public function consulterlistecolonnesAction()
	{
		
		// action body
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
		
		$header=array(
				"idPILOT_LISTCOLUMN" =>"ID",
				"PILOT_PLATEFORME_idPILOT_PLATEFORME" => "ID plateforme",
				"LABELCOLUMN" => "Label",
				"DESCRIPTION" => "Description",
				"TABELCOLUM" => "Table colonne",
				"COLUMNNAME" => "Nom du colonne",
				"OPERATIONSQL" => "Operation"
		);
		
		$usermapper= new Application_Model_Mapper_PilotListcolumn();
		$select=$usermapper->fetchAllToArray();
		$page=$this->_getParam('page',1);
		$paginator = Zend_Paginator::factory($select);
		$paginator->setItemCountPerPage(3);
		$paginator->setCurrentPageNumber($page);
		
		$this->view->header=$header;
		
		$this->view->keyOfData="idPILOT_LISTCOLUMN";
		
		Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
		$this->view->paginator=$paginator;
	
	}
	
	public function modifierlistecolonneAction()
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
			
		$AFAffich = new  Application_Form_modifierlistecolonne();
		$AFAffich->setAction($this->_helper->url('modifierlistecolonne','modelmangement','pilotage'));
		$this->view->Formulairemodifierlistcolonnes = $AFAffich;
			
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
			
			//var_dump($formData);exit;
			if ($AFAffich->isValid($formData)) {
	
				$albums = new Application_Model_DbTable_PilotListcolumn();
				
				$albums->update(array(
						"PILOT_PLATEFORME_idPILOT_PLATEFORME"=>$AFAffich->getValue('PILOT_PLATEFORME_idPILOT_PLATEFORME'),
						"DESCRIPTION"=>$AFAffich->getValue('DESCRIPTION'),
						"LABELCOLUMN"=>$AFAffich->getValue('LABELCOLUMN'),
						"TABELCOLUM" =>$AFAffich->getValue('TABELCOLUM'),
						"COLUMNNAME" =>$AFAffich->getValue('COLUMNNAME'),
						"OPERATIONSQL" =>$AFAffich->getValue('OPERATIONSQL')),
						"idPILOT_LISTCOLUMN = '".$AFAffich->getValue('idPILOT_LISTCOLUMN')."'");
	
				$this->_helper->redirector('consulterlistecolonnes');
				
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$reqcomp = new Application_Model_DbTable_PilotListcolumn();
				$data=$reqcomp->fetchRow("idPILOT_LISTCOLUMN = '".$id."'")->toArray();
					
				$AFAffich->populate($data);
			}
		}
	}
	
	public function deletlistcolonneAction()
	{
		$this->_helper->layout()->disableLayout();
		 
		$this->view->id = $this->_getParam('id');
		$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
		 
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
			 
			if ($formData['operation']=="oui")
			{
		
					
				$colum = new Application_Model_PilotListcolumn();				 
		
				$colum->setIdPILOTLISTCOLUMN($formData['id']);
		
				$listcolum = new Application_Model_Mapper_PilotListcolumn();
		
				$listcolum->delete($colum);
				
				
				 
				$this->_helper->redirector('consulterlistecolonnes','Modelmangement');
			}
			else
			{
				$this->_helper->redirector("consulterlistecolonnes");
			}
			
		}
	}
	public function deletenamecolonneAction()
	{
		$this->_helper->layout()->disableLayout();
			
		$this->view->id = $this->_getParam('id');
		$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
			
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
		
			if ($formData['operation']=="oui")
			{
		
					
				$colum = new Application_Model_PilotNamecolumn();
		
				$colum->setIdPILOTNAMECOLUMN($formData['id']);
		
				$namcolum = new Application_Model_Mapper_PilotNamecolumn();
		
				$namcolum->delete($colum);
		
		
					
				$this->_helper->redirector('gestionnamecolonnes','Modelmangement');
			}
			else
			{
				$this->_helper->redirector("gestionnamecolonnes");
			}
				
		}
	}
	
	public function deletedefcolonneAction()
	{
		$this->_helper->layout()->disableLayout();
			
		$this->view->id = $this->_getParam('id');
		$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
			
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
	
			if ($formData['operation']=="oui")
			{
	
					
				$colum = new Application_Model_PilotDefcolumn();
	
				$colum->setIdPILOTDEFCOLUMN($formData['id']);
	
				$defcolum = new Application_Model_Mapper_PilotDefcolumn();
	
				$defcolum->delete($colum);
	
	
					
				$this->_helper->redirector('gestiondefinitiondescolonnes','Modelmangement');
			}
			else
			{
				$this->_helper->redirector("gestiondefinitiondescolonnes");
			}
	
		}
	}
	
	public function deleteactiviteAction()
	{
		$this->_helper->layout()->disableLayout();
			
		$this->view->id = $this->_getParam('id');
		$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
			
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
		
			if ($formData['operation']=="oui")
			{
		
					
				$activite = new Application_Model_PilotModelactivite();
		
				$activite->setIdPILOTMODELACTIVITE($formData['id']);
		
				$activites = new Application_Model_Mapper_PilotModelactivite();
		
				$activites->delete($activite);
		
		
					
				$this->_helper->redirector('gestionactivite','Modelmangement');
			}
			else
			{
				$this->_helper->redirector("gestionactivite");
			}
		
		}
	}
	
	public function modifieractiviteAction()
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
			
		$AFAffich = new  Application_Form_modifieractivite();
		$AFAffich->setAction($this->_helper->url('modifieractivite','modelmangement','pilotage'));
		$this->view->Formulairemodifieractivite = $AFAffich;
			
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
				
			//var_dump($formData);exit;
			if ($AFAffich->isValid($formData)) {
	
				$albums = new Application_Model_DbTable_PilotModelactivite();
	
				$albums->update(array(
						"DESCRIPTION"=>$AFAffich->getValue('DESCRIPTION')),
						"idPILOT_MODELACTIVITE = '".$AFAffich->getValue('idPILOT_MODELACTIVITE')."'");
	
				$this->_helper->redirector('gestionactivite');
	
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$reqcomp = new Application_Model_DbTable_PilotModelactivite();
				$data=$reqcomp->fetchRow("idPILOT_MODELACTIVITE = '".$id."'")->toArray();
					
				$AFAffich->populate($data);
			}
		}
	}
	
	public function gestionactiviteAction()
	{
		// action body
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
	
		$header=array(
				"idPILOT_MODELACTIVITE" =>"ID",
				"DESCRIPTION" => "Description"
		);
	
		$usermapper= new Application_Model_Mapper_PilotModelactivite();
		$select=$usermapper->fetchAllToArray();
		$page=$this->_getParam('page',1);
		$paginator = Zend_Paginator::factory($select);
		$paginator->setItemCountPerPage(3);
		$paginator->setCurrentPageNumber($page);
	
		$this->view->header=$header;
	
		$this->view->keyOfData="idPILOT_MODELACTIVITE";
	
		Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
		$this->view->paginator=$paginator;
	}
	
	
	public function gestionaxeAction()
	{
		// action body
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
	
		$header=array(
				"idPILOT_AXES" =>"ID",
		);
	
		$usermapper= new Application_Model_Mapper_PilotAxes();
		$select=$usermapper->fetchAllToArray();
		$page=$this->_getParam('page',1);
		$paginator = Zend_Paginator::factory($select);
		$paginator->setItemCountPerPage(3);
		$paginator->setCurrentPageNumber($page);
	
		$this->view->header=$header;
	
		$this->view->keyOfData="idPILOT_AXES";
	
		Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
		$this->view->paginator=$paginator;
	}
	
	public function modifieraxeAction()
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
			
		$AFAffich = new  Application_Form_modifieraxe();
		$AFAffich->setAction('modifieraxe');
		//$AFAffich->setAction($this->_helper->url('gestionaxe','modelmangement','pilotage'));
		$this->view->Formulairemodifieraxe = $AFAffich;
			
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
	
			//var_dump($formData);exit;
			if ($AFAffich->isValid($formData)) {
	
				$albums = new Application_Model_DbTable_PilotAxes();
	
				$albums->update(array(
						"idPILOT_AXES"=>$AFAffich->getValue('idPILOT_AXES')));
						//"idPILOT_AXES = '".$AFAffich->getValue('idPILOT_AXES')."'");
	
				$this->_helper->redirector('gestionaxe');
	
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$reqcomp = new Application_Model_DbTable_PilotAxes();
				$data=$reqcomp->fetchRow("idPILOT_AXES = '".$id."'")->toArray();
					
				$AFAffich->populate($data);
			}
		}
	}
	
	public function deleteaxeAction()
	{
		$this->_helper->layout()->disableLayout();
			
		$this->view->id = $this->_getParam('id');
		$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
			
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
	
			if ($formData['operation']=="oui")
			{
					
				$activite = new Application_Model_PilotAxes();
	
				$activite->setIdPILOTAXES($formData['id']);
	
				$activites = new Application_Model_Mapper_PilotAxes();
	
				$activites->delete($activite);
	
				$this->_helper->redirector('gestionaxe','modelmangement');
			}
			else
			{
				$this->_helper->redirector("gestionaxe");
			}
		}
	}
	
	public function gestionassigneaxeactiviteAction()
	{
		//action body
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
	
		$header=array(
				"idPILOT_AXEACTIVITE" =>"ID",
				"idPILOT_AXES" =>"ID Axe",
				"idPILOT_MODELACTIVITE" =>"ID Model",
		);
	
		$usermapper= new Application_Model_Mapper_PilotAxeactivite();
		$select=$usermapper->fetchAllToArray();
		$page=$this->_getParam('page',1);
		$paginator = Zend_Paginator::factory($select);
		$paginator->setItemCountPerPage(3);
		$paginator->setCurrentPageNumber($page);
	
		$this->view->header=$header;
	
		$this->view->keyOfData="idPILOT_AXEACTIVITE";
	
		Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
		$this->view->paginator=$paginator;
	}
	
	public function deleteassigneaxeactiviteAction()
	{
		$this->_helper->layout()->disableLayout();
			
		$this->view->id = $this->_getParam('id');
		$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
			
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
	
			if ($formData['operation']=="oui")
			{
	
					
				$activite = new Application_Model_PilotAxeactivite();
	
				$activite->setIdPILOTAXEACTIVITE($formData['id']);
	
				$activites = new Application_Model_Mapper_PilotAxeactivite();
	
				$activites->delete($activite);
	
				$this->_helper->redirector('gestionassigneaxeactivite','Modelmangement');
			}
			else
			{
				$this->_helper->redirector("gestionassigneaxeactivite");
			}
	
		}
	}
	
	public function modifierassigneaxeactiviteAction()
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
			
		$AFAffich = new  Application_Form_modifierassigneaxeactivite();
		$AFAffich->setAction($this->_helper->url('gestionassigneaxeactivite','modelmangement','pilotage'));
		$this->view->Formulairemodifierassigneaxeactivite = $AFAffich;
			
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
	
			//var_dump($formData);exit;
			if ($AFAffich->isValid($formData)) {
	
				$albums = new Application_Model_DbTable_PilotAxeactivite();
	
				$albums->update(array(
						"idPILOT_MODELACTIVITE"=>$AFAffich->getValue('idPILOT_MODELACTIVITE'),
						"idPILOT_AXES"=>$AFAffich->getValue('idPILOT_AXES')),
						"idPILOT_AXEACTIVITE = '".$AFAffich->getValue('idPILOT_AXEACTIVITE')."'");
	
				$this->_helper->redirector('gestionassigneaxeactivite');
	
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$reqcomp = new Application_Model_DbTable_PilotAxeactivite();
				$data=$reqcomp->fetchRow("idPILOT_AXEACTIVITE = '".$id."'")->toArray();
					
				$AFAffich->populate($data);
			}
		}
	}
	
	///////////////////////////////////////////////////////////////
	
	
	public function gestionassignemodelctiviteAction()
	{
		//action body
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
	
		$header=array(
				"idPILOT_MODELACTIVITEANALYSE" =>"ID",
				"idPILOT_MODELANALYSE" =>"ID Model",
				"idPILOT_MODELACTIVITE" =>"ID Activite",
		);
	
		$usermapper= new Application_Model_Mapper_PilotModelactiviteanalyse();
		$select=$usermapper->fetchAllToArray();
		$page=$this->_getParam('page',1);
		$paginator = Zend_Paginator::factory($select);
		$paginator->setItemCountPerPage(3);
		$paginator->setCurrentPageNumber($page);
	
		$this->view->header=$header;
	
		$this->view->keyOfData="idPILOT_MODELACTIVITEANALYSE";
	
		Zend_View_Helper_PaginationControl::setDefaultViewPartial('controls.phtml');
		$this->view->paginator=$paginator;
	}
	
	public function deleteassignemodelctiviteAction()
	{
		$this->_helper->layout()->disableLayout();
			
		$this->view->id = $this->_getParam('id');
		$this->view->messagedelate= "voulez-vous vraiment supprimer cette enregisterement ?";
			
		if ($this->_request->isPost ())
		{
			$formData = $this->_request->getPost ();
	
			if ($formData['operation']=="oui")
			{
	
					
				$activite = new Application_Model_PilotModelactiviteanalyse();
	
				$activite->setIdPILOTAXEACTIVITE($formData['id']);
	
				$activites = new Application_Model_Mapper_PilotModelactiviteanalyse();
	
				$activites->delete($activite);
	
				$this->_helper->redirector('gestionassignemodelctivite','Modelmangement');
			}
			else
			{
				$this->_helper->redirector("gestionassignemodelctivite");
			}
		}
	}
	
	public function modifierassignemodelctiviteAction()
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->layout()->setLayout("gestionlayout");
			
		$AFAffich = new  Application_Form_modifierassignemodelctivite();
		$AFAffich->setAction($this->_helper->url('gestionassigneaxeactivite','modelmangement','pilotage'));
		$this->view->Formulairemodifierassignemodelctivite = $AFAffich;
			
		if ($this->getRequest()->isPost()) {
			$formData = $this->getRequest()->getPost();
	
			//var_dump($formData);exit;
			if ($AFAffich->isValid($formData)) {
	
				$albums = new Application_Model_DbTable_PilotModelactiviteanalyse();
	
				$albums->update(array(
						"idPILOT_AXEACTIVITE"=>$AFAffich->getValue('idPILOT_AXEACTIVITE'),
						"idPILOT_MODELANALYSE"=>$AFAffich->getValue('idPILOT_MODELANALYSE')),
						"idPILOT_MODELACTIVITEANALYSE = '".$AFAffich->getValue('idPILOT_MODELACTIVITEANALYSE')."'");
	
				$this->_helper->redirector('gestionassignemodelctivite');
	
			} else {
				$AFAffich->populate($formData);
			}
		} else {
			$id = $this->_getParam('id');
			if (!empty($id)) {
				$reqcomp = new Application_Model_DbTable_PilotModelactiviteanalyse();
				$data=$reqcomp->fetchRow("idPILOT_MODELACTIVITEANALYSE = '".$id."'")->toArray();
					
				$AFAffich->populate($data);
			}
		}
	}
}